#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <set>

using namespace std;
typedef pair<int, int> PII;

void test1(){
    cout << "set base usage:" << endl;
    set<int> s;
    cout << s.size() << endl;
    s.insert(3);
    s.insert(4);
    s.insert(2);
    cout << s.size() << endl;
    return;
}

void test2(){
    cout << "set feature:" << endl;
    set<int> s;
    cout << s.size() << endl;
    s.insert(3);
    s.insert(4);
    s.insert(3);
    cout << s.size() << endl;
    return;
}

void test3(){
    cout << "set feature2:" << endl;
    set<PII> s;
    cout << s.size() << endl;
    s.insert(PII(3, 0));
    s.insert(PII(4, 1));
    s.insert(PII(3, 2));
    cout << s.size() << endl;
    return;
}

void test4(){
    cout << "set feature3:" << endl;
    set<PII> s;
    cout << s.size() << endl;
    s.insert(PII(3, 0));
    s.insert(PII(4, 1));
    s.insert(PII(3, 2));
    cout << s.size() << endl;
    for(auto x:s){
        cout << "(" << x.first <<", " << x.second << ")" << endl;
    }
    return;
}

void test5(){
    cout << "set replace Min heap:" << endl;
    set<PII> s;
    for(int i = 0; i < 10;i++){
        s.insert(PII(rand() % 20, i)); // push heap
    }
    for(auto x:s){
        cout << "(" << x.first <<", " << x.second << ")" << endl;
    }
    for(int i = 0;i < 5;i++){
        cout << "s.begin = " << s.begin()->first << endl; // pop heap
        s.erase(s.begin()); // pop heap
    }
    return;
}

void test6(){
    cout << "set replace Max heap:" << endl;
    set<PII> s;
    for(int i = 0; i < 10;i++){
        s.insert(PII(-rand() % 20, i)); // push heap
    }
    for(auto x:s){
        cout << "(" << x.first <<", " << x.second << ")" << endl;
    }
    for(int i = 0;i < 5;i++){
        cout << "s.begin = " << -s.begin()->first << endl; // pop heap
        s.erase(s.begin()); // pop heap
    }
    return;
}

int main(){
    // test1();
    // test2();
    // test3();
    // test4();
    // test5();
    test6();
    return 0;
}